



#ifndef __WINDOWFILTER_H
#define __WINDOWFILTER_H

#include "user_type.h"


// flag == 0 返回 D1+ D2 的结果  ;flag == 1 返回 D1- D2 的结果  
typedef size_t(*Windowfilter_cb)(size_t d1,size_t d2,uint8_t flag);

typedef struct Windowfilter_t
{
    size_t lv;              //采样值
    uint16_t ww;     //窗口
    Windowfilter_cb cb;    
       
}Windowfilter_t;





void Windowfilter_init(Windowfilter_t* hd,uint16_t ww,Windowfilter_cb cb,size_t init_val);

void Windowfilter_add_val(Windowfilter_t* hd,size_t val);

size_t Windowfilter_get_data(Windowfilter_t* hd);

#endif










